# -*- coding: utf-8 -*-
#'django-serializable'
#Copyright (C) 2010 Sébastien Piquemal @ futurice
#contact : sebastien.piquemal@futurice.com
#futurice's website : www.futurice.com

#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

from django.conf.urls.defaults import *
from django.conf import settings

from testmodels.models import *

from serializable.views import get_or_post_serializable, delete_serializable, get_serializable_list

urlpatterns = patterns('',
    #pickle
	url(r'^author/(?P<firstname>\w+)/(?P<lastname>\w+)/$', get_or_post_serializable, kwargs={"model": Author}),
	url(r'^book/list/(?P<author__lastname>\w+)/$', get_serializable_list, kwargs={"model": Book, "filters": ["author__lastname"]}),
	url(r'^book/list/$', get_serializable_list, kwargs={"model": Book}),
    url(r'^book/(?P<pk>\w+)/$', get_or_post_serializable, kwargs={"model": Book}),
    url(r'^book/delete/(?P<pk>\w+)/$', delete_serializable, kwargs={"model": Book}),
    # json
	url(r'^book-json/list/$', get_serializable_list, kwargs={"model": Book, "format": "json"}),
    url(r'^book-json/delete/(?P<pk>\w+)/$', delete_serializable, kwargs={"model": Book, "format": "json"}),
	url(r'^book-json/(?P<pk>\w+)/$', get_or_post_serializable, kwargs={"model": Book, "format": "json"}),
)

